s = input().split()
n = int(s[0])
target = int(s[1])
nums = [int(x) for x in input().split(" ")]
left = 0
right = 0
minLen = n + 1
sum = nums[left]
while True:
    if sum < target:
        right += 1
        if right >= n:
            break
        sum += nums[right]
    else:
        len = right - left + 1
        minLen = min(len, minLen)
        sum -= nums[left]
        left += 1
        if left > right:
            break
if minLen == n + 1:
    print(0)
else:
    print(minLen)